class Node:
    def __init__(self, val):
        self.val = val
        self.next = None

    def __str__(self):
        return str(self.val)+"->"+str(self.next)
def remove_node(head: Node, val):
    dummyHead = Node(-1)
    dummyHead.next = head
    start = dummyHead
    while start and start.next:
        if start.next.val == val:
            start.next = start.next.next
        else:
            start = start.next
    return dummyHead.next

def to_node(nodes):
    node_list = [Node(x) for x in nodes]
    for i in range(1, len(nodes)):
        node_list[i-1].next = node_list[i]
    return node_list[0]

print(remove_node(to_node([1,1,6,3,4,5,6]), 1))